* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  overflow-x: hidden;
}
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-family: Roboto, sans-serif;
  background: white;
  min-height: 100vh;
  overflow-x: hidden;
  /*padding: 20px;*/
}

/* Aviso sin conexión */
#offline-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.offline-content {
  background: white;
  padding: 40px;
  border-radius: 10px;
  text-align: center;
  max-width: 500px;
  margin: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.offline-content h3 {
  color: #f44336;
  font-size: 24px;
  margin-bottom: 20px;
}

.offline-content p {
  color: #333;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 10px;
}
a:not([href]):not([tabindex]) {
  color: #007bff;
  cursor: pointer;
  text-decoration: underline;
  text-decoration: none;
  background-color: transparent;
}
.container {
  /* layout revert */
  display: block;
  flex: none;
  width: 100%;
  max-width: 100%;
  margin: 0;
  background-color: white;
  padding: 30px;
  /*border-radius: 10px;*/
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
#background {
  background-color: black;
  background-image: url("./Balanza_Schopper_centrada.jpg") !important;
  background-position: center !important;
  background-size: cover;
  background-repeat: no-repeat !important;
  display: flex;
  flex: 1 0 auto;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 40px 20px 30px;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  flex-wrap: nowrap;
}
#title {
  line-height: 1.2;
  margin-bottom: 0px;
  padding-top: 8px;
  padding-bottom: 0%;
  padding-left: 5%;
  padding-right: 5%;
  font-weight: bold;
  width: 100%;
  max-width: 100%;
  text-align: center;
  text-transform: uppercase;
  color: white;
  font-size: xx-large;
  vertical-align: middle;
  text-shadow: 2px 2px 5px black, -1px -1px 3px #000;
}
.title2 {
  /*position: absolute;*/
  /*top: calc(65% - 60px);*/
  left: 0;
  right: 0;
  text-align: center;
  vertical-align: middle;
  text-align: center; 
  font-size: large;
  font-weight: bold;
  margin-top:	0px;
  color: white;
  text-shadow: 2px 2px 5px black, -1px -1px 3px black;	
}
#address{
  font-style: normal;
  margin-top:	10%;
  margin-bottom:	10%;
}

.title2 a {
  color: white;
  text-decoration: none;
  text-shadow: 2px 2px 5px black, -1px -1px 3px black;
}
.title2 a:hover {
  color: #f0f0f0;
  text-decoration: underline;
}
.title3 {
  text-align: left;
  font-size: large;
  font-weight: bold;
  margin-top: 0px;
  margin-bottom: 0px;
  color: black;
  margin-left: 0px;
}
.container > ul {
  margin-left: 0px;
  padding-left: 20px;
}
h1 {
  color: black;
  margin-bottom: 10px;
  text-align: center;
  font-size: 28px;
}
.subtitle {
  text-align: center;
  color: black;
  margin-bottom: 30px;
  font-size: 14px;
  font-size: medium;
}
.toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  grid-template-columns: auto 1fr;
  align-items: start;
}

.toolbar > .form-field {
  grid-column: 1;
  grid-row: 1;
}

.toolbar > .button-group:nth-of-type(1) {
  grid-column: 2;
  grid-row: 1;
  justify-self: start;
}

.toolbar > .button-group:nth-of-type(2) {
  grid-column: 1 / -1;
  justify-self: start;
}
.form-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  margin-right: 8px;
  gap: 6px;
}
#btnDescripcion {
  margin-left: 0;
  margin-right: 4px;
}
label {
  font-weight: bold;
  margin: 0;
  color: black;
  font-size: 13px;
}
input[type="number"],
select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  transition: border-color 0.3s;
}
.form-field select {
  flex: 0 0 140px;
  display: block;
}
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}
.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 0;
  align-items: flex-end;
}
button {
  background-color: #667eea;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  transition: background-color 0.3s;
  white-space: nowrap;
}
button:hover {
  background-color: #5568d3;
}
button:active {
  background-color: #4452b8;
}
.btn-secondary {
  background-color: #2196F3;
}
.btn-secondary:hover {
  background-color: #0b7dda;
}
.btn-danger {
  background-color: #f44336;
}
.btn-danger:hover {
  background-color: #da190b;
}
.btn-info {
  background-color: #17a2b8;
}
.btn-info:hover {
  background-color: #138496;
}

.table-section {
  margin-top: 30px;
}
.table-section h2 {
  color: black;
  margin-bottom: 15px;
  font-size: 18px;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

#banner {
  font-family: Roboto,sans-serif;
  font-size: medium;
  text-align: left;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0;
  color: black;
  min-height: 50px;
  margin-bottom: 0px;
  margin-right: 0px;
  overflow-x: hidden;
}
#banner iframe#paginas {
  width: calc(100% - 5px);
  display: block;
  border: none;
  height: 100vh;
  min-height: 400px;
  border: none;
  background-color: transparent;
  overflow-y: auto;
  overflow-x: hidden;
  transition: none;
}
#banner ul{
	font-family: Roboto,sans-serif;
	list-style-position: inside;
	font-size: medium;
}
#banner li{
	font-family: Roboto,sans-serif;
	font-size: medium;
}
#footer {
	height: 3%;
  font-weight: normal;
  height: fit-content;
  min-height: 120px;
  display: flex !important;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
  border-top: 3px solid rgba(135,206,235,0.3);
  position: relative;
  font-weight: normal;
  height: fit-content;
  min-height: 120px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  background: linear-gradient(135deg, #00577B 0%, #0077A3 50%, #00577B 100%);
  line-height: 1.3;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 2%;
  padding-right: 2%;
  padding-top: 2%;
  padding-bottom: 2%;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
  position: relative;
  z-index: 10;
  clear: both;
  margin-top: auto;
  margin-bottom: -25px;
  margin-right: 5px;
  animation: slideInUp 1.8s ease-out;  
}
#ultima_actualizacion {
  height: auto;
  height: fit-content;
  color: white;
  margin: 0;
  font-size: medium;
}


/* Modal de Descripción */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.modal-content {
  position: relative;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1001;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid #17a2b8;
}
.modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
}
.modal-close:hover {
  color: #333;
}
.modal-body {
  padding-right: 20px;
  padding-top: 0px;
  padding-bottom: 0%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.modal-body > ul {
  margin-left: 0px;
  padding-left: 20px;
}
.description-item {
  padding-right: 12px;
  padding-bottom: 0%;
  padding-top: 0%;
  border-radius: 3px;
  line-height: 1.5;
}
.description-item strong {
  color: #17a2b8;
  display: inline;
}
#table {
  font-size: 13px;
}
.tabulator-tableholder {
  border: 1px solid #ddd;
  border-radius: 4px;
}
.tabulator .tabulator-header {
  background-color: #667eea;
  color: white;
}
.tabulator .tabulator-header .tabulator-col {
  border-right: 1px solid #556bcd;
  color: white;
}
.tabulator .tabulator-row {
  border-bottom: 1px solid #ddd;
}
.tabulator .tabulator-row:hover {
  background-color: #f5f5f5;
}
.tabulator .tabulator-row.tabulator-selectable:hover {
  background-color: #e8eaf6;
}
.tabulator-cell {
  vertical-align: middle;
  padding: 8px;
}
.tabulator-cell input[type="number"],
.tabulator-cell select {
  width: 100%;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
}
.tabulator-cell input[type="number"]:focus,
.tabulator-cell select:focus {
  border-color: #667eea;
  box-shadow: 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Jspreadsheet v4 */
/* Permitir múltiples líneas en encabezados */
#spreadsheet {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
#spreadsheet .jspreadsheet thead,
#spreadsheet .jexcel thead {
  height: auto !important;
}
#spreadsheet .jspreadsheet thead th,
#spreadsheet .jexcel thead th {
  white-space: normal !important;
  word-wrap: break-word !important;
  height: auto !important;
  min-height: 35px !important;
  line-height: 1.3 !important;
  padding: 8px 4px !important;
  vertical-align: middle !important;
}
#spreadsheet .jspreadsheet thead th,
#spreadsheet .jexcel thead th,
#spreadsheet .jspreadsheet tbody td,
#spreadsheet .jexcel tbody td {
  color: black !important;
}
#spreadsheet .jspreadsheet thead th:nth-child(8),
#spreadsheet .jexcel thead th:nth-child(8) { background-color: lightgreen !important; }

/* También aplicar colores a los headers */
.jspreadsheet thead tr th:nth-child(2) {
  background-color: lightblue !important;
}
.jspreadsheet thead tr th:nth-child(3) {
  background-color: lightblue !important;
}
.jspreadsheet thead tr th:nth-child(4) {
  background-color: lightblue !important;
}
.jspreadsheet thead tr th:nth-child(5) {
  background-color: lightblue !important;
}
.jspreadsheet thead tr th:nth-child(6) {
  background-color: lightgreen !important;
}
.jspreadsheet thead tr th:nth-child(7) {
  background-color: lightgreen !important;
}

/* ========================================
   RESPONSIVE DESIGN - Media Queries
   ======================================== */

/* Pantallas grandes (Desktop XL) - 1920px+ */
@media (min-width: 1920px) {
  .container {
    padding: 40px 60px;
  }
  #title {
    font-size: xxx-large;
  }
}

/* Pantallas medianas-grandes (Desktop) - 1200px a 1919px */
@media (min-width: 1200px) and (max-width: 1919px) {
  .container {
    padding: 30px 50px;
  }
}

/* Tablets landscape y pantallas medianas - 992px a 1199px */
@media (min-width: 992px) and (max-width: 1199px) {
  .container {
    padding: 25px 40px;
  }
  #title {
    font-size: x-large;
    max-width: 90%;
  }
  .toolbar {
    gap: 8px;
  }
}

/* Tablets portrait - 768px a 991px */
@media (min-width: 768px) and (max-width: 991px) {
  .container {
    padding: 20px 30px;
  }
  #background {
    padding: 30px 15px 20px;
  }
  #title {
    font-size: x-large;
    max-width: 95%;
    padding-left: 3%;
    padding-right: 3%;
  }
  .title2 {
    font-size: medium;
  }
  .toolbar {
    gap: 8px;
  }
  .button-group {
    gap: 8px;
  }
  button {
    padding: 9px 16px;
    font-size: 12px;
  }
  #banner iframe#paginas {
    min-height: 350px;
  }
}

/* Móviles landscape y tablets pequeñas - 576px a 767px */
@media (min-width: 576px) and (max-width: 767px) {
  .container {
    padding: 18px;
    box-shadow: none;
    border: none;
  }
  #background {
    padding: 25px 10px 20px;
    min-height: 80vh;
  }
  #title {
    font-size: large;
    max-width: 98%;
    padding-left: 2%;
    padding-right: 2%;
  }
  .title2 {
    font-size: medium;
  }
  .title3 {
    font-size: medium;
  }
  h1 {
    font-size: 20px;
  }
  .toolbar {
    display: flex; /* Override grid en móvil */
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .form-field {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }
  .form-field select {
    flex: 1 1 auto;
    max-width: 200px;
  }
  .button-group {
    flex-direction: column; /* Botones en columna, ancho completo */
    width: 100%;
    gap: 8px;
  }
  button {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    font-size: 12px;
  }
  .table-section h2 {
    font-size: 16px;
  }
  #banner iframe#paginas {
    min-height: 300px;
  }
  /* Evitar scroll horizontal de la página y permitirlo solo en la planilla */
  html, body { overflow-x: hidden; }
  #spreadsheet { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .container > ul {
    padding-left: 18px;
  }
  .container > ul li {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
  }
}

/* Móviles portrait - menos de 576px */
@media (max-width: 575px) {
  body {
    padding: 0;
    overflow-x: hidden;
  }
  .container {
    padding: 15px;
    box-shadow: none;
    border: none;
    border-radius: 0;
  }
  #background {
    padding: 20px 8px 15px;
    min-height: 70vh;
  }
  #title {
    font-size: medium;
    max-width: 100%;
    padding: 8px 5px;
    line-height: 1.3;
  }
  .title2 {
    font-size: small;
    padding: 0 10px;
  }
  .title3 {
    font-size: medium;
  }
  #address {
    font-size: small;
    margin-top: 8%;
    margin-bottom: 8%;
  }
  h1 {
    font-size: 18px;
  }
  .toolbar {
    display: flex; /* Override grid en móvil */
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  .form-field {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .form-field label {
    margin-bottom: 5px;
  }
  .form-field select {
    flex: none;
    width: 100%;
    max-width: 100%;
  }
  .button-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  button {
    width: 100%;
    padding: 12px 16px;
    font-size: 13px;
  }
  .table-section {
    margin-top: 20px;
  }
  .table-section h2 {
    font-size: 15px;
  }
  #banner {
    /*width: 100%;*/
    margin-bottom: 20px;
  }
  #banner iframe#paginas {
    min-height: 250px;
  }
  .container > ul {
    padding-left: 16px;
  }
  .container > ul li {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 10px;
  }
  .modal-content {
    width: 95%;
    margin: 10px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-header h3 {
    font-size: 16px;
  }
  .description-item {
    font-size: 12px;
    /*padding: 10px;*/
  }
  #footer {
    font-size: small;
    padding: 15px 10px;
  }
  #footer img {
    width: 15% !important;
  }
  /* Ajustes para la tabla jspreadsheet en móviles */
  #spreadsheet {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .jspreadsheet {
    font-size: 11px;
  }
  .jspreadsheet thead th {
    font-size: 11px;
    padding: 6px 3px !important;
  }
  .jspreadsheet tbody td {
    font-size: 11px;
    padding: 6px 3px;
  }
}

/* Móviles muy pequeños - menos de 375px */
@media (max-width: 374px) {
  #title {
    font-size: small;
  }
  .title2 {
    font-size: x-small;
  }
  button {
    font-size: 12px;
    padding: 10px 12px;
  }
  .container > ul li {
    font-size: 12px;
  }
  .jspreadsheet {
    font-size: 10px;
  }
  .jspreadsheet thead th,
  .jspreadsheet tbody td {
    font-size: 10px;
  }
}

/* Orientación landscape en móviles */
@media (max-width: 767px) and (orientation: landscape) {
  .container {
    padding: 12px 10px;
  }
  #background {
    min-height: auto;
    padding: 10px 5px;
  }
  #title {
    font-size: medium;
    padding-top: 3px;
    padding-bottom: 3px;
  }
  .title2 {
    font-size: small;
  }
  #address {
    margin-top: 3%;
    margin-bottom: 3%;
  }
  /* Toolbar en landscape: mantener dos filas y ocupar todo el ancho */
  .toolbar {
    display: grid; /* Reponer grid en landscape */
    grid-template-columns: auto 1fr;
    gap: 6px;
    width: 100%;
  }
  .form-field {
    margin-right: 4px;
  }
  .form-field select {
    flex: 0 0 120px;
  }
  .toolbar > .button-group:nth-of-type(1) {
    grid-column: 2;
    grid-row: 1;
    justify-self: stretch;
    width: 100%;
  }
  .toolbar > .button-group:nth-of-type(2) {
    grid-column: 1 / -1; /* Segunda fila a lo ancho */
    justify-self: stretch;
    width: 100%;
  }
  .button-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
  }
  /* En landscape, los botones vuelven a auto-width para no verse angostos */
  .button-group button,
  button {
    width: auto;
    min-width: 0;
    flex: 0 1 auto;
    padding: 6px 10px;
    font-size: 11px;
  }
  .table-section h2 {
    font-size: 14px;
  }
}

/* Ocultar separadores vacíos en el menú contextual de Jspreadsheet */
.jexcel_contextmenu > hr:first-child,
.jexcel_contextmenu > hr:empty {
  display: none;
}